# import requests
# def
import requests

class Tpshoplogin(object):
    @classmethod
    def yzm(cls, session: object) -> requests.Response:
        """
        :rtype: object
        """
        session.get('http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=verify')

    @classmethod
    def login(cls,session,data):
        url = 'http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=do_login'
        headers = {
            "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
        }
        res = session.post(url=url, headers=headers, data=data)
        return res

# order = session.get('http://hmshop-test.itheima.net/Home/Order/order_list.html')
# print(order.text)

# res = requests.post(url=url,headers=headers,data=data,cookies=cookie)
# print(res.json())
# import requests
#
# r_code = requests.get('http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=verify&r=0.6244419300439055')
#
# cookie = r_code.cookies
#
# url = 'http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=do_login&t=0.11840456378144903'
#
# headers = {
#     "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
# }
#
# data = {
#     "username": "13012345678",
#     "password": "123456",
#     "verify_code": "8888"
# }
# r_login = requests.post(url=url, headers=headers, data=data, cookies=cookie)
# print(f"登录状态码: {r_login.status_code}")
# print(f"登录状响应体: {r_login.json()}")
#
# r_order = requests.get('http://hmshop-test.itheima.net/Home/Order/order_list.html',cookies=cookie)
#
# print(f"订单状态码: {r_order.status_code}")
# print(f"订单状响应体: {r_order.text}")
